package com.alphasta.project.system.ncp.controller;

import com.alphasta.framework.shiro.web.filter.LogoutFilter;
import com.alphasta.framework.web.controller.BaseController;
import com.alphasta.framework.web.page.TableDataInfo;
import com.alphasta.project.system.ncp.entity.NcpPersonInfoFrom;
import com.alphasta.project.system.ncp.service.NcpPersonInfoService;
import com.alphasta.project.system.ncp.entity.NcpPersonInfoVO;
import com.alphasta.project.system.ncp.entity.NcpPersonInfoVOII;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * ncp 确诊和疑似
 *
 * @author alphasta
 */
@Controller
@RequestMapping("/ncp/ncpPersonInfo")
public class NcpPersonController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(LogoutFilter.class);
    private String prefix = "/ncp/ncpPersonInfo";
    @Autowired
    private NcpPersonInfoService ncpPersonInfoService;
    @RequiresPermissions("ncp:ncpPersonInfo:view")
    @GetMapping()
    public String ncpPersonInfo()
    {
        return prefix + "/ncpPersonInfo";
    }
    @RequiresPermissions("ncp:ncpPersonInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(NcpPersonInfoFrom ncpPersonInfoFrom)
    {
        List<NcpPersonInfoVOII> data=new ArrayList<>();
            try {
                startPage();
                NcpPersonInfoVO ncpPersonInfoVO = ncpPersonInfoService.NcpPersonInfo(ncpPersonInfoFrom);
                data.add(ncpPersonInfoVO.getData());
            } catch (Exception e) {
                e.printStackTrace();
                log.error("查询出错 e={}",e);
            }
        return getDataTable(data);
    }
}